package com.shenzhen.group.niuniu.card;

import com.shenzhen.group.common.card.Card;
import com.shenzhen.group.common.card.operation.AbstractCardOperation;
import com.shenzhen.group.common.card.operation.CardOperation;
import com.shenzhen.group.common.entity.CardGroupBase;
import com.shenzhen.group.common.entity.HandCardGroupBase;
import com.shenzhen.group.common.game.Position;
import com.shenzhen.group.common.player.Player;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

/**
 * @author tooStronger
 * @description: 牛牛操作
 * @date 2021/9/20
 */
@Slf4j
public class NiuniuOperation extends AbstractCardOperation {

    /*** 牛牛牌总数 */
    private static final Integer CARD_NUM_SUM = 54;
    /*** 牛牛当次发牌数 */
    private static final Integer ONE_SEND_SUM = 5;

    public NiuniuOperation() {
        this(CARD_NUM_SUM, ONE_SEND_SUM);
    }

    public NiuniuOperation(Integer cardNumSum, Integer oneSendSum) {
        super(oneSendSum, cardNumSum);
    }

    @Override
    protected HandCardGroupBase generateHandCard(Integer curPos, List<Card> cards, int positionCount) {
        NiuniuHandCardGroup niuniuHandCardGroup = new NiuniuHandCardGroup();
        List<Card> handCardList = new ArrayList<>();
        for (int i = 0; i < ONE_SEND_SUM; i++) {
            Card card = cards.get(curPos + positionCount * i);
            handCardList.add(card);
        }
        niuniuHandCardGroup.setCards(handCardList);
        return niuniuHandCardGroup;
    }
}
